package top.yxf.mcp.server.juejing.infrastructure.gateway;

import retrofit2.Call;
import retrofit2.http.*;
import top.yxf.mcp.server.juejing.infrastructure.gateway.dto.JueJinCreateArticleRequestDTO;
import top.yxf.mcp.server.juejing.infrastructure.gateway.dto.JueJinCreateArticleResponseDTO;
import top.yxf.mcp.server.juejing.infrastructure.gateway.dto.JueJinPublishRequestDTO;
import top.yxf.mcp.server.juejing.infrastructure.gateway.dto.JueJinPublishResponseDTO;

/**
 * 掘金服务接口
 */
public interface IJueJingService {

    /**
     * 创建文章（草稿）
     *
     * @param cookie Cookie信息
     * @param request 文章请求对象
     * @return 创建结果
     */
    @POST("content_api/v1/article_draft/create?aid=2608&uuid=7429276068975412747")
    @Headers({
        "accept: */*",
        "accept-language: zh-CN,zh;q=0.9,en;q=0.8",
        "content-type: application/json",
        "origin: https://juejin.cn",
        "priority: u=1, i",
        "referer: https://juejin.cn/",
        "sec-ch-ua: \"Google Chrome\";v=\"135\", \"Not-A.Brand\";v=\"8\", \"Chromium\";v=\"135\"",
        "sec-ch-ua-mobile: ?0",
        "sec-ch-ua-platform: \"macOS\"",
        "sec-fetch-dest: empty",
        "sec-fetch-mode: cors",
        "sec-fetch-site: same-site",
        "user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36",
        "x-secsdk-csrf-token: 000100000001abc7bc1537646a6110962d0e8f9d526bd4bf5387b44342658047f13ea58798d4183a17225a3cf3ad",
    })
    Call<JueJinCreateArticleResponseDTO> createArticle(
            @Header("Cookie") String cookie,
            @Body JueJinCreateArticleRequestDTO request
    );

    /**
     * 发布文章
     *
     * @param cookie Cookie信息
     * @param request 发布文章请求对象
     * @return 发布结果
     */
    @POST("content_api/v1/article/publish?aid=2608&uuid=7429276068975412747")
    @Headers({
        "accept: */*",
        "accept-language: zh-CN,zh;q=0.9,en;q=0.8",
        "content-type: application/json",
        "origin: https://juejin.cn",
        "priority: u=1, i",
        "referer: https://juejin.cn/",
        "sec-ch-ua: \"Google Chrome\";v=\"135\", \"Not-A.Brand\";v=\"8\", \"Chromium\";v=\"135\"",
        "sec-ch-ua-mobile: ?0",
        "sec-ch-ua-platform: \"macOS\"",
        "sec-fetch-dest: empty",
        "sec-fetch-mode: cors",
        "sec-fetch-site: same-site",
        "user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36",
        "x-secsdk-csrf-token: 000100000001abc7bc1537646a6110962d0e8f9d526bd4bf5387b44342658047f13ea58798d4183a17225a3cf3ad"
    })
    Call<JueJinPublishResponseDTO> publishArticle(
            @Header("Cookie") String cookie,
            @Body JueJinPublishRequestDTO request
    );

    /**
     * 使用完整cookie字符串发布文章
     *
     * @param request 发布文章请求对象
     * @return 发布结果
     */
    @POST("content_api/v1/article/publish?aid=2608&uuid=7429276068975412747")
    @Headers({
        "accept: */*",
        "accept-language: zh-CN,zh;q=0.9,en;q=0.8",
        "content-type: application/json",
        "origin: https://juejin.cn",
        "priority: u=1, i",
        "referer: https://juejin.cn/",
        "sec-ch-ua: \"Google Chrome\";v=\"135\", \"Not-A.Brand\";v=\"8\", \"Chromium\";v=\"135\"",
        "sec-ch-ua-mobile: ?0",
        "sec-ch-ua-platform: \"macOS\"",
        "sec-fetch-dest: empty",
        "sec-fetch-mode: cors",
        "sec-fetch-site: same-site",
        "user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36",
        "x-secsdk-csrf-token: 0001000000015d2274c9a0d5c55079cf12026ca448c93ff5eb50a524bbf785deb07e9bde788e183a114dc9aa70b2",
        "Cookie: _tea_utm_cache_2608=undefined; __tea_cookie_tokens_2608=%257B%2522web_id%2522%253A%25227429276068975412747%2522%252C%2522user_unique_id%2522%253A%25227429276068975412747%2522%252C%2522timestamp%2522%253A1729763151859%257D; csrf_session_id=b7ff2c86c4234098c8dfae0c2bf8d084; passport_csrf_token=7a043eab87d6922e858f4172f0ab2988; passport_csrf_token_default=7a043eab87d6922e858f4172f0ab2988; n_mh=I1mq8T-_KaxpPeqR7o143NiA5UZAbZJeK353DWzNhHc; sid_guard=ff556ee3b411d53b20086175db090183%7C1745660236%7C31536000%7CSun%2C+26-Apr-2026+09%3A37%3A16+GMT; uid_tt=674275a9e05f6595bd276c8c5894d85b; uid_tt_ss=674275a9e05f6595bd276c8c5894d85b; sid_tt=ff556ee3b411d53b20086175db090183; sessionid=ff556ee3b411d53b20086175db090183; sessionid_ss=ff556ee3b411d53b20086175db090183; is_staff_user=false; sid_ucp_v1=1.0.0-KDQ3MDYwODY4ZDM1MWMzZjNkNzkwODJjNDFhODBkZTUzMzRjMDFiMDYKFwj-94DW4PXTAhDM0rLABhiwFDgHQPQHGgJsZiIgZmY1NTZlZTNiNDExZDUzYjIwMDg2MTc1ZGIwOTAxODM; ssid_ucp_v1=1.0.0-KDQ3MDYwODY4ZDM1MWMzZjNkNzkwODJjNDFhODBkZTUzMzRjMDFiMDYKFwj-94DW4PXTAhDM0rLABhiwFDgHQPQHGgJsZiIgZmY1NTZlZTNiNDExZDUzYjIwMDg2MTc1ZGIwOTAxODM"
    })
    Call<JueJinPublishResponseDTO> publishArticleWithFullCookie(
            @Body JueJinPublishRequestDTO request
    );
}
